package com.health.system.model.system;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.health.system.javacommon.base.BaseEntity;

public class UserRole extends BaseEntity {
	

	//date formats
	
	//columns START
	private java.lang.String id;
	private java.lang.String userId;
	private java.lang.String roleId;
	/***处理多个属性值*/
	private java.lang.String[] roleIdArray;
	private java.lang.String roleIdStr;
	
	//columns END

	public UserRole(){
	}
	
	/**
	 * 13548634105
	 * 生成 角色字符集 89759159 
	 * @author 鲍中启 2010-05-21
	 * @return
	 */
	public java.lang.String[] getRoleIdArray() {
		if(getRoleIdStr()==null||getRoleIdStr().length()<1){
			return null;
		}else{
			String[] testString = getRoleIdStr().split(",");
			String[] test = new String[testString.length];
			  //String to int
			  for (int i = 0; i < testString.length; i++) {
			   test[i] = testString[i].replaceAll(" ", "");
			  }
			return test;
		}
	}



	public java.lang.String getRoleIdStr() {
		return roleIdStr;
	}

	public void setRoleIdStr(java.lang.String roleIdStr) {
		this.roleIdStr = roleIdStr;
	}

	public UserRole(
		java.lang.String id
	){
		this.id = id;
	}

	public void setId(java.lang.String value) {
		this.id = value;
	}
	
	public java.lang.String getId() {
		return this.id;
	}
	public void setUserId(java.lang.String value) {
		this.userId = value;
	}
	
	public java.lang.String getUserId() {
		return this.userId;
	}
	public void setRoleId(java.lang.String value) {
		this.roleId = value;
	}
	
	public java.lang.String getRoleId() {
		return this.roleId;
	}

	public String toString() {
		return new ToStringBuilder(this)
			.append("Id",getId())
			.append("UserId",getUserId())
			.append("RoleId",getRoleId())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.append(getUserId())
			.append(getRoleId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof UserRole == false) return false;
		if(this == obj) return true;
		UserRole other = (UserRole)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.append(getUserId(),other.getUserId())
			.append(getRoleId(),other.getRoleId())
			.isEquals();
	}
}

